package com.collection;

import java.util.ArrayList;

/**
 * @Author WaveHi
 * @Date 13/8/2021 上午 11:55
 * @Version 1.0
 * @Contact HJBWaveHi@163.com
 * @Description 测试通配符？的使用
 */
public class TestWildcard {

    public static void main(String[] args) {

        //获取测试对象
        ArrayList<Person> persons = new ArrayList();
        ArrayList<Student> students = new ArrayList<Student>();
        ArrayList<Object> objects = new ArrayList<Object>();
        ArrayList<? extends Person> others1 = null;
        ArrayList<? super Person> others2 = null;

        //测试
//        others1 = objects;//编译器报错
        others1 = persons;
        others1 = students;
        others2 = objects;
        others2 = persons;
        //others2 = students;//编译器报错

    }

}
